package lu.med.praxiswahl.wahlumed.client.kalender;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableColumn;

import lu.med.praxiswahl.wahlumed.client.utilities.ColumnWidthControler;
import lu.med.praxiswahl.wahlumed.client.wclient.Main;


@SuppressWarnings("serial")
public class AlleTermineTable extends JTable
{
    public AlleTermineTable(AlleTermineTableModel model)
    {
	super(model);
	this.setTableHeader(tableHeader);
	this.setRowHeight(30);
	this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	this.selectionModel = getSelectionModel();
	// this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

	ColumnWidthControler c = new ColumnWidthControler(
		Main.COLUMNWIDTH_CONFIGURATION_FILE, "calendartbl", this);

	TableColumn column = null;
	for (int i = 0; i < 12; i++)
	{
	    column = this.getColumnModel().getColumn(i);
	    switch (i)
	    {
	    case 0:
		column.setPreferredWidth(c.getColumnWidth(0));
		break;
	    case 1:
		column.setPreferredWidth(c.getColumnWidth(1));
		break;
	    case 2:
		column.setPreferredWidth(c.getColumnWidth(2));
		break;
	    case 3:
		column.setPreferredWidth(c.getColumnWidth(3));
		break;
	    case 4:
		column.setPreferredWidth(c.getColumnWidth(4));
		break;
	    case 5:
		column.setPreferredWidth(c.getColumnWidth(5));
		break;
	    case 6:
		column.setPreferredWidth(c.getColumnWidth(6));
		break;
	    case 7:
		column.setPreferredWidth(c.getColumnWidth(7));
		break;
	    case 8:
		column.setPreferredWidth(c.getColumnWidth(8));
		break;
	    case 9:
		column.setPreferredWidth(c.getColumnWidth(9));
		break;
	    case 10:
		column.setPreferredWidth(c.getColumnWidth(10));
		break;
	    case 11:
		column.setPreferredWidth(c.getColumnWidth(11));
		break;
	    }
	}
    }
}